package com.cy.detectsys.mapper;

import com.cy.detectsys.entity.DbIana;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cy.detectsys.model.dto.DbIanaDO;
import org.apache.ibatis.annotations.Select;

/**
* @author admin
* @description 针对表【db_iana】的数据库操作Mapper
* @createDate 2024-05-08 19:03:44
* @Entity com.cy.detectsys.entity.DbIana
*/
public interface DbIanaMapper extends BaseMapper<DbIana> {


    @Select("SELECT\n" +
            "\tdb_wide_ping.ky_ed_wide_ping_sudomain subdomain,\n" +
            "\tdb_wide_ping.ky_ed_wide_ping_ip ip,\n" +
            "\tky_ed_wide_ping_location location,\n" +
            "\tdb_target_subdomain.tb_net_target_subdomain_domain domain,\n" +
            "\tdetect_target.ky_net_target_importance importance,\n" +
            "\tdetect_target.ky_net_target_name targetname,\n" +
            "\tdetect_target.ky_net_target_brief targetbrief\n" +
            "FROM\n" +
            "\tdb_wide_ping\n" +
            "\tJOIN db_target_subdomain ON db_wide_ping.ky_ed_wide_ping_sudomain = db_target_subdomain.tb_net_target_subdomain \n" +
            "\tjoin detect_target on db_target_subdomain.tb_net_target_id = detect_target.id\n" +
            "WHERE\n" +
            "\tky_ed_wide_ping_ip = #{ip} \n" +
            "\tAND ky_ed_wide_ping_sudomain IS NOT NULL \n" +
            "\tLIMIT 1")
    DbIanaDO addAdditonalInfo(String ip);


    @Select("SELECT\n" +
            "\tdb_wide_ping.ky_ed_wide_ping_sudomain,\n" +
            "\tdb_wide_ping.ky_ed_wide_ping_ip,\n" +
            "\tky_ed_wide_ping_location,\n" +
            "\tdb_target_subdomain.tb_net_target_subdomain_domain\n" +
            "\n" +
            "FROM\n" +
            "\tdb_wide_ping\n" +
            "\tJOIN db_target_subdomain ON db_wide_ping.ky_ed_wide_ping_sudomain = db_target_subdomain.tb_net_target_subdomain \n" +
            "WHERE\n" +
            "\tky_ed_wide_ping_ip =#{ip} \n" +
            "\tAND ky_ed_wide_ping_sudomain IS NOT NULL \n" +
            "\tLIMIT 1")
    DbIanaDO addAdditonalInfo2(String ip);
}




